package com.credithc.signature.manager.controller.management;

import com.credithc.baseserv.core.codes.CoreCodes;
import com.credithc.baseserv.core.message.Message;
import com.credithc.baseserv.core.message.MessageFactory;
import com.credithc.baseserv.pageHelper.PageInfo;
import com.credithc.signature.manager.ro.ChannelRo;
import com.credithc.signature.manager.service.ChannelMService;
import com.credithc.signature.manager.vo.ChannelVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/manager/scs/v2/management")
public class ChannelMController {

    @Autowired
    private ChannelMService channelMService;

    @Autowired
    private MessageFactory messageFactory;

    @GetMapping("/channel/list")
    public Message queryAll( ChannelRo channelRo) {
        PageInfo<ChannelVo> pageInfo = channelMService.queryAll(channelRo);
        Map map = new HashMap<>(16);
        map.put("pageInfo", pageInfo);
        return messageFactory.getInstance(CoreCodes.CORE_SUCCESS, map);
    }
}
